Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't materialize when broadcasting Zeros with Vector #211

Merged
merged 6 commits into from
Apr 18, 2023

Conversation

jishnub
Copy link
Member

@jishnub jishnub commented Mar 6, 2023

Fix #208
After this,

julia> x = zeros(4000); y = Zeros(size(x)); z = copy(x);

julia> @btime $z .= $x .+ $y;
  917.057 ns (0 allocations: 0 bytes)

julia> @btime $z .= $x .+ $x;
  1.117 μs (0 allocations: 0 bytes)

julia> f(u, v) = ( u .+= v);

julia> @btime f($z, $x);
  872.268 ns (0 allocations: 0 bytes)

julia> @btime f($z, $y);
  5.871 ns (0 allocations: 0 bytes)

Currently, this assumes that + is commutative, but that's not strictly necessary.

@codecov
Copy link

codecov bot commented Mar 6, 2023

Codecov Report

Merging #211 (7bfe07b) into master (dc8aa6e) will increase coverage by 0.79%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #211      +/-   ##
==========================================
+ Coverage   99.04%   99.84%   +0.79%     
==========================================
  Files           4        5       +1     
  Lines         630      654      +24     
==========================================
+ Hits          624      653      +29     
+ Misses          6        1       -5     
Impacted Files Coverage Δ
src/fillalgebra.jl 100.00% <100.00%> (+1.09%) ⬆️
src/fillbroadcast.jl 99.24% <100.00%> (+1.57%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@jishnub
Copy link
Member Author

jishnub commented Mar 17, 2023

I've fixed the merge issues

@jishnub
Copy link
Member Author

jishnub commented Mar 29, 2023

Gentle bump @dlfivefifty

@dlfivefifty
Copy link
Member

Is it possible to add a test to check for the old, wrong behaviour?

@jishnub
Copy link
Member Author

jishnub commented Apr 14, 2023

Updated

@jishnub
Copy link
Member Author

jishnub commented Apr 18, 2023

Gentle bump @dlfivefifty

@dlfivefifty dlfivefifty merged commit 8fac81d into JuliaArrays:master Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broadcasting with FillArray allocates and is much slower
2 participants